package com.example.administrator.nurse.model.adapter;

import android.util.SparseArray;
import android.view.View;

/**
 * Created by Administrator on 2016/3/30.
 */
public class ViewHolder {
    public static <T extends View> View get(int id,View convertView){
        SparseArray<View> viewHolder= (SparseArray<View>) convertView.getTag();
        if (viewHolder==null){
            viewHolder=new SparseArray<>();
            convertView.setTag(viewHolder);
        }
        View childView =viewHolder.get(id);
        if (childView==null){
            childView=convertView.findViewById(id);
            viewHolder.put(id,childView);
        }
        return childView;
    }
}
